<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>用户信息表添加--${site.name}</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <meta name="description" content="${site.description}"/>
    <meta name="keywords" content="${site.keywords}"/>
    <meta name="author" content="${site.author}"/>
    <link rel="icon" href="${site.logo}">
    <link rel="stylesheet" href="${base}/static/layui/css/layui.css" media="all" />
    <style type="text/css">
        .layui-form-item .layui-inline{ width:33.333%; float:left; margin-right:0; }
        @media(max-width:1240px){
            .layui-form-item .layui-inline{ width:100%; float:none; }
        }
        .layui-form-item .role-box {
            position: relative;
        }
        .layui-form-item .role-box .jq-role-inline {
            height: 100%;
            overflow: auto;
        }

    </style>
</head>
<body class="childrenBody">
<form class="layui-form" style="width:80%;">
    <div class="layui-form-item">
        <label class="layui-form-label">昵称</label>
        <div class="layui-input-block">

            <input  type="text"  class="layui-input" name="userName"  placeholder="请输入昵称">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">手机号</label>
        <div class="layui-input-block">

            <input  type="text"  class="layui-input" name="phone"  placeholder="请输入手机号">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">销售编码</label>
        <div class="layui-input-block">

            <input  type="text"  class="layui-input" name="saleManCode"  placeholder="请输入销售编码">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">密码</label>
        <div class="layui-input-block">

            <input  type="text"  class="layui-input" name="password"  placeholder="请输入密码">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">成员类型</label>
        <div class="layui-input-block">

            <select name="memberType" >
                <option value="" selected="">请选择成员类型</option>
                <@my type="electricity_user_member_type">
                <#list result as r>
                <option value="${r.value}" >${r.label}</option>
                </#list>
                </@my>
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">公司名称</label>
        <div class="layui-input-block">

            <input  type="text"  class="layui-input" name="companyName"  placeholder="请输入公司名称">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">企业性质</label>
        <div class="layui-input-block">

            <select name="businessProperty" >
                <option value="" selected="">请选择企业性质</option>
                <@my type="electricity_user_business_property">
                <#list result as r>
                <option value="${r.value}" >${r.label}</option>
                </#list>
                </@my>
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">发电类型</label>
        <div class="layui-input-block">

            <input  type="text"  class="layui-input" name="PowerGenerationType"  placeholder="请输入发电类型">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">装机容量</label>
        <div class="layui-input-block">

            <input  type="text"  class="layui-input" name="installedCapacity"  placeholder="请输入装机容量">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">上年度上网电量</label>
        <div class="layui-input-block">

            <input  type="text"  class="layui-input" name="internetPowerLastYear"  placeholder="请输入上年度上网电量">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">注册资本金</label>
        <div class="layui-input-block">

            <input  type="text"  class="layui-input" name="registerCapital"  placeholder="请输入注册资本金">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">是否拥有配电网</label>
        <div class="layui-input-block">

            <select name="isHaveNetwork" >
                <option value="" selected="">请选择是否拥有配电网</option>
                <@my type="electricity_user_is_have_network">
                <#list result as r>
                <option value="${r.value}" >${r.label}</option>
                </#list>
                </@my>
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">用户类型</label>
        <div class="layui-input-block">

            <input  type="text"  class="layui-input" name="userType"  placeholder="请输入用户类型">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">用户电压等级</label>
        <div class="layui-input-block">

            <input  type="text"  class="layui-input" name="userVoltageGrade"  placeholder="请输入用户电压等级">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">是否园区用户</label>
        <div class="layui-input-block">

            <select name="isCampusUser" >
                <option value="" selected="">请选择是否园区用户</option>
                <@my type="electricity_user_is_campus_user">
                <#list result as r>
                <option value="${r.value}" >${r.label}</option>
                </#list>
                </@my>
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">上年用电量</label>
        <div class="layui-input-block">

            <input  type="text"  class="layui-input" name="energyUsedLastYear"  placeholder="请输入上年用电量">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">信用等级</label>
        <div class="layui-input-block">

            <@my type="electricity_user_credit_grade">
                <#list result as r>
                <input type="radio" name="creditGrade"  value="${r.value}" title="${r.label}">
                </#list>
            </@my>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">社会统一信用代码</label>
        <div class="layui-input-block">

            <input  type="text"  class="layui-input" name="creditCode"  placeholder="请输入社会统一信用代码">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">营业执照</label>
        <div class="layui-input-block">

            <input type="hidden" class="layui-input" name="businessLicense" id="businessLicense" >
            <div class="layui-upload">
                <button type="button" class="layui-btn" id="test_businessLicense">上传图片</button>
                <div class="layui-upload-list">
                    <img class="layui-upload-img" id="demo_businessLicense">
                    <p id="demoText_businessLicense"></p>
                </div>
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">省份</label>
        <div class="layui-input-block">

            <input  type="text"  class="layui-input" name="businessProvince"  placeholder="请输入省份">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">市区</label>
        <div class="layui-input-block">

            <input  type="text"  class="layui-input" name="businessCity"  placeholder="请输入市区">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">区县</label>
        <div class="layui-input-block">

            <input  type="text"  class="layui-input" name="businessCountry"  placeholder="请输入区县">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">地址详细信息</label>
        <div class="layui-input-block">

            <input  type="text"  class="layui-input" name="businessDetail"  placeholder="请输入地址详细信息">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">经办人</label>
        <div class="layui-input-block">

            <input  type="text"  class="layui-input" name="managerName"  placeholder="请输入经办人">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">经办人电话</label>
        <div class="layui-input-block">

            <input  type="text"  class="layui-input" name="managerPhone"  placeholder="请输入经办人电话">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">头像</label>
        <div class="layui-input-block">

            <input type="hidden" class="layui-input" name="img" id="img" >
            <div class="layui-upload">
                <button type="button" class="layui-btn" id="test_img">上传图片</button>
                <div class="layui-upload-list">
                    <img class="layui-upload-img" id="demo_img">
                    <p id="demoText_img"></p>
                </div>
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">身份证号</label>
        <div class="layui-input-block">

            <input  type="text"  class="layui-input" name="idCard"  placeholder="请输入身份证号">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="" lay-filter="addElectricityUser">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
<script type="text/javascript" src="${base}/static/layui/layui.js"></script>
<script>
    layui.use(['form','jquery','layer','upload'],function(){
        var form      = layui.form,
                $     = layui.jquery,
                upload = layui.upload,
                layer = layui.layer;

        //普通图片上传
        var upload_picPath = upload.render({
            elem: '#test_businessLicense',
            url: '${base}/file/upload/',
            field:'test',
            before: function(obj){
                //预读本地文件示例，不支持ie8
                obj.preview(function(index, file, result){
                    $('#demo_businessLicense').attr('src', result); //图片链接（base64）
                });
            },
            done: function(res){
                //如果上传失败
                if(res.success == false){
                    return layer.msg('上传失败');
                }
                $("#businessLicense").val(res.data.url);
            },
            error: function(){
                //演示失败状态，并实现重传
                var demoText = $('#demoText_businessLicense');
                demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-mini demo-reload">重试</a>');
                demoText.find('.demo-reload').on('click', function(){
                    upload_picPath.upload();
                });
            }
        });
        //普通图片上传
        var upload_picPath = upload.render({
            elem: '#test_img',
            url: '${base}/file/upload/',
            field:'test',
            before: function(obj){
                //预读本地文件示例，不支持ie8
                obj.preview(function(index, file, result){
                    $('#demo_img').attr('src', result); //图片链接（base64）
                });
            },
            done: function(res){
                //如果上传失败
                if(res.success == false){
                    return layer.msg('上传失败');
                }
                $("#img").val(res.data.url);
            },
            error: function(){
                //演示失败状态，并实现重传
                var demoText = $('#demoText_img');
                demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-mini demo-reload">重试</a>');
                demoText.find('.demo-reload').on('click', function(){
                    upload_picPath.upload();
                });
            }
        });
        form.on("submit(addElectricityUser)",function(data){

            var loadIndex = layer.load(2, {
                shade: [0.3, '#333']
            });
            $.post("${base}/admin/electricityUser/add",data.field,function(res){
                layer.close(loadIndex);
                if(res.success){
                    parent.layer.msg("用户信息表添加成功！",{time:1000},function(){
                        parent.layer.close(parent.addIndex);
                        //刷新父页面
                        parent.location.reload();
                    });
                }else{
                    layer.msg(res.message);
                }
            });
            return false;
        });

    });
</script>
</body>
</html>